<%@ page contentType="text/html; charset=utf-8" language="java" import="java.sql.*" errorPage="" %>
<%@ page import="socnet.controller.*" %>
<%@ page import="socnet.model.*" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<link href="./login.css" rel="stylesheet" type="text/css" />
</head>

<body>

<div class="container">
  <div class="header"><h1 >
      <h1 ><img src="images/GEEK_small.jpg" alt="Insert Logo Here" float="left name="Insert_logo" width="100" height="100" id="Insert_logo" style="background-color: #8090AB; display:block; float:right;" />
  Welcome at GeekSocNet! </h1> 
<br />

    <!-- end .header --></div>

    <%
		if (request.getParameter("registerSubmit") != null) {
				String password = request.getParameter("password");
				String name = request.getParameter("name");
				String email = request.getParameter("email");
				String year = " ", month = " ", day = " ";
				year = request.getParameter("year");
				month = request.getParameter("month");
				day = request.getParameter("day");
				
				
				String birth = year + "/" + month + "/" + day;
				System.out.println(birth + "A");
				//	year = request.getParameter("year"); 
			
					if (email == null || email == "") { 
						%>
						<script type="text/javascript">
							alert("Plz. Enter your email!");
						</script>
						<%
					} else if (name == null || name == "") { 
					%>
					<script type="text/javascript">
						alert("Plz. Enter your name!");
					</script>
					<%
					} else if (password == null || password == "") {
						%>
						<script type="text/javascript">
							alert("Plz. Enter your password!");
						</script>
						<%
					} else {
					
						if(SocnetController.emailIsValid(email)) {
							response.sendRedirect("myPage.jsp");
						} else {
	//						User user = new User(email, birth,password, false, name, name);
						}
					}
				
		}
		%>
        
  <div class="sidebar1">
      <form action="register.jsp" method="post">
        Email: <br />
        <input name="email" type="text" size="20" maxlength="20" /> <br />
        Full Name: <br />
        <input name="name" type="text" size="20" maxlength="30" /> <br />
        Password: <br />
        <input name="password" type="password" size="20" maxlength="30" /> <br />
        Born Date: <br />
        <select id="year" name="year">
   <%      for (int i = 1900; i < 2013; i++) {
            %>
            <option value = "<%=i%>"><%=i%></option>
            <% 
                }
            %>
  		</select>
        <select id="month" name="month">
<%      for (int i = 1; i < 13; i++) {
            %>
            <option value = "<%=i%>"><%=i%></option>
            <% 
                }
            %>     
  		</select>
        <select id="day" name="day">
   <%      for (int i = 1; i <= 31; i++) {
            %>
            <option value = "<%=i%>"><%=i%></option>
            <% 
   				}
            %>
  		</select>
        <br />
        <input type="submit" value="Register" name="registerSubmit"/>
        </form>
    <!-- end .sidebar1 --></div>
  <div class="content">
    <h1><img src="images/born-geek.jpg" width="100%" /><!-- end .content --></h1>
  </div>

  <!-- end .container --></div>
</body>
</html>